package xyz.xiaomeiqiu.study.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import xyz.xiaomeiqiu.study.dao.OrderDao;
import xyz.xiaomeiqiu.study.domain.Order;

import java.util.List;

@Service
public class OrderService {

    @Autowired
    private OrderDao orderDao;

    public Order addOne(Order order) {
        return orderDao.save(order);
    }

    public List<Order> addAll(List<Order> orders) {
        return orderDao.saveAll(orders);
    }

    public Order findById(Long orderId) {
        return orderDao.findById(orderId).get();
    }
}
